using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BezPanike.Domain;
using BezPanike.Domain.Services;

public partial class Register_aspx : System.Web.UI.Page
{
    protected void Register_OnClick(object sender, ImageClickEventArgs e)
    {
        var korisnik = new Korisnici();

        korisnik.Ime = tbIme.Text;
        korisnik.Prezime = tbPrezime.Text;
        korisnik.KorisnickoIme = tbKorisnickoIme.Text;
        korisnik.Lozinka = tbLozinka.Text;
        korisnik.Email = tbEmail.Text;

        var korisniciService = new KorisniciService();
        bool success = korisniciService.DodajKorisnika(korisnik);

        if (success)
        {
            lblStatusText.Text = "Uspesno ste registrovali nalog";
            Response.Redirect("Login.aspx");
        }
        else
        {
            lblStatusText.Text = "Nalog nije uspesno registrovan.";
        }

    }
}